package com.wjx.user_consumer.service;

import com.wjx.user_consumer.model.Appointment;
import com.wjx.user_consumer.model.Rating;
import com.wjx.user_consumer.model.Serve;
import com.wjx.user_consumer.model.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;


import java.util.List;

@Component
@FeignClient(name = "user-provider", fallback = UserServiceFallback.class)
public interface UserService {
    @PostMapping("/login")
    public User login(@RequestParam("username") String username)  ;
    @PostMapping("/register")
    public int register(@RequestParam("username") String username,@RequestParam("password") String password,@RequestParam("authority") String authority)  ;
    @PostMapping("/service-center")
    public List<Serve> showService()  ;
    @PostMapping("/search")
    public List<Serve> search(@RequestParam("keyword") String keyword)  ;
    @PostMapping("/user-queryServiceById")
    public Serve queryServiceById(@RequestParam("id") int id)  ;
    @PostMapping("/user-queryRatingByServiceId")
    public List<Rating> queryRatingByServiceId(@RequestParam("id") int id)  ;
    @PostMapping("/user-queryUserById")
    public User queryUserById(@RequestParam("id") int id)  ;
    @PostMapping("/user-addAppointment")
    public int addAppointment(@RequestParam("userId") int userId,@RequestParam("serviceId") int serviceId,@RequestParam("appointmentTime") String appointmentTime,
                              @RequestParam("appointmentLocation") String appointmentLocation, @RequestParam("phone") String phone,@RequestParam("status") String status,
                              @RequestParam("createdTime") String createdTime,@RequestParam("lastUpdatedTime")  String lastUpdatedTime)  ;
    @PostMapping("/user-queryAppointmentByUserId")
    public List<Appointment> queryAppointmentByUserId(@RequestParam("id") int id)  ;
    @PostMapping("/user-updateScoreById")
    public int updateScoreById(@RequestParam("id") int id,@RequestParam("score")
    int score,@RequestParam("feedback") String feedback,@RequestParam("lastUpdatedTime")
    String lastUpdatedTime)  ;
    @PostMapping("/user-queryRatingById")
    public Rating queryRatingById(@RequestParam("id") int id)  ;
    @PostMapping("/user-deleteRatingById")
    public int deleteRatingById(@RequestParam("id") int id)  ;
    @PostMapping("/user-queryRatingByAppointmentId")
    public Rating queryRatingByAppointmentId(@RequestParam("appointmentId") int appointmentId)  ;
    @PostMapping("/user-addRating")
    public int addRating(@RequestParam("serviceId") int serviceId,@RequestParam("appointmentId") int appointmentId,
                         @RequestParam("userId") int userId,@RequestParam("score") int score,
                         @RequestParam("feedback") String feedback,@RequestParam("createdTime") String createdTime,
                         @RequestParam("lastUpdatedTime") String lastUpdatedTime)  ;
    @PostMapping("/user-updateUserById")
    public int updateUserById(@RequestParam("id") int id,@RequestParam("username") String username,
                              @RequestParam("password") String password,
                              @RequestParam("authority") String authority)  ;
}
